package ypmits.effects {
	import flash.display.Sprite;
	import flash.geom.Point;

	/**
	 * @author Dave Lenz
	 * TODO: NOG AFMAKEN
	 */
	public class Lightning extends Sprite {
		private var numDivisions : int = 5;

		public function Lightning( startpoint : Point, endpoint : Point ) {
			graphics.clear();
			graphics.lineStyle( 1, 0xFFFFFF );
			graphics.moveTo(endpoint.x, endpoint.y);
			graphics.lineTo(startpoint.x, startpoint.y );
			
			for (var i : int = 0; i < numDivisions; i++) {
				getMiddlePoint(startpoint, endpoint );
			}
		}
		
		
		private function getMiddlePoint( p1 : Point, p2 : Point ) : Point {
			var p : Point = new Point(p1.x + p2.x * .5, p1.y + p2.y * .5 );
			return p;
		}
	}
}
